import request from '@/utils/request'

// 查询airDetails列表
export function listAirDetails(query) {
  return request({
    url: '/gatewayManagement/airDetails/list',
    method: 'get',
    params: query
  })
}

// 查询airDetails详细
export function getAirDetails(airDetailsId) {
  return request({
    url: '/gatewayManagement/airDetails/' + airDetailsId,
    method: 'get'
  })
}

// 新增airDetails
export function addAirDetails(data) {
  return request({
    url: '/gatewayManagement/airDetails',
    method: 'post',
    data: data
  })
}

// 修改airDetails
export function updateAirDetails(data) {
  return request({
    url: '/gatewayManagement/airDetails',
    method: 'put',
    data: data
  })
}

// 删除airDetails
export function delAirDetails(airDetailsId) {
  return request({
    url: '/gatewayManagement/airDetails/' + airDetailsId,
    method: 'delete'
  })
}

// mqtt 配置信息
export function mqttConfigInfo(){
  return request({
    url: '/gatewayManagement/airDetails/mqttConfigInfo',
    method: 'get'
  })
}

// 配置应用服务器
export function migrationService(mainboardIds){
  return request({
    url: '/gatewayManagement/airDetails/migrationService',
    method: 'post',
    data: mainboardIds
  })
}

// 查询网关配置信息
export function selectGatewayConfigInfo(mainboardId){
  return request({
    url: '/gatewayManagement/airDetails/selectGatewayConfigInfo',
    method: 'post',
    data: mainboardId
  })
}

//  单文件下载
export function downloadFile(){
  return request({
    url: '/gatewayManagement/airDetails/downloadFile',
    method: 'post'
  })
}

//  远程 OTA
export function remoteOTA(downloadUrl, mainboardIds, selectType){
  return request({
    url: '/gatewayManagement/airDetails/remoteOTA',
    method: 'post',
    data: { downloadUrl,
            mainboardIds,
            selectType  }
  })
}

// 预约下载 任务
export function reserveDownloadTask(data){
  return request({
    url: '/gatewayManagement/airDetails/reserveDownloadTask',
    method: 'post',
    data: data
  })
}
